package com.ny.mapper;

import com.ny.entity.Device;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeviceMapper {

    // 查询所有的设备信息
    @Select("SELECT * FROM device")
    List<Device> findAllDevices();

    // 根据设备名称查询设备信息
    @Select("SELECT * FROM device WHERE device_name LIKE CONCAT('%', #{deviceName}, '%')")
    List<Device> findDevicesByName(@Param("deviceName") String deviceName);

    // 根据设备ID删除设备信息
    @Delete("DELETE FROM device WHERE device_id = #{deviceId}")
    int deleteDeviceById(@Param("deviceId") int deviceId);
}